﻿using OnlineSoccerManager.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace OnlineSoccerManager.Converter
{
    public class TranslatorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            
            string resource = value as string;
            string prefix = parameter as string;

            if (resource == null)
                return value;

            if (prefix != null)
                resource = prefix + resource;

            return Translator.Instance[resource];
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
